﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class test : MonoBehaviour,IPointerExitHandler
{
    private bool isMouse;
    private void Start()
    {
       
    }
    private void FixedUpdate()
    {
        //if (Input.GetMouseButtonDown(0))
        //{
        //    isMouse = true;
        //}
        //if (Input.GetMouseButtonUp(0))
        //{
        //    isMouse = false;
        //}
        //if (isMouse)
        //{
        //    go();
        //}
       
    }


    private void Update()
    {
        

    }


    private void go()
    {
        Vector3 mousepoint = Vector3.zero;

        RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

        if (hit.collider!=null)
        {
            Debug.DrawLine(Camera.main.transform.position,hit.point,Color.green);
            if (hit.collider.tag=="Rope")
            {
                Debug.Log("碰到了");
            }
        }

    }

    public void OnPointerEnter(PointerEventData eventData)
    {
        Debug.Log("鼠标进入");
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        throw new System.NotImplementedException();
    }

    private void OnMouseOver()
    {
        Debug.Log("鼠标进入了");
    }
}
